/**
 * 
 */
package de.midnightdance.admin.user;

import java.util.Iterator;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

import de.cbf.util.ui.editentities.interfaces.ICompositeEditEntity;
import de.cbf.util.ui.editentities.interfaces.ICompositeEntities;
import de.cbf.util.ui.editentities.interfaces.IEditableEntity;
import de.cbf.util.ui.editentities.template.AbstractCompositeEditEntities;

/**
 * @author Stefan Alter
 *
 */
public class CompositeEditUsers extends AbstractCompositeEditEntities {

	private CompositeEditUser 	compositeEditUser;
	private CompositeListUsers 	compositeListUser;
	
	public CompositeEditUsers(Composite parent, int style) {
		super(parent, style);
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.template.AbstractCompositeEditEntities#initializeCompositeEntities(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	protected ICompositeEntities initializeCompositeEntities(Composite parent) {
		compositeListUser = new CompositeListUsers(parent, SWT.NONE);
		return compositeListUser;
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.template.AbstractCompositeEditEntities#initializeCompositeEntityEdit(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	protected ICompositeEditEntity initializeCompositeEntityEdit(
			Composite parent) {
		compositeEditUser =   new CompositeEditUser(parent, SWT.NONE);
		return compositeEditUser;
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.interfaces.ICompositeEditEntities#getCompositeEditEntity()
	 */
	@Override
	public ICompositeEditEntity getCompositeEditEntity() {
		return compositeEditUser;
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.interfaces.ICompositeEditEntities#getEntitySelected()
	 */
	@Override
	public IEditableEntity getEntitySelected() {
		return compositeListUser.getSelectedEntity();
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.interfaces.ICompositeEditEntities#setEntities(java.util.Iterator)
	 */
	@Override
	public void setEntities(Iterator<IEditableEntity> values) {
		compositeListUser.setEntities(values);
	}

	/* (non-Javadoc)
	 * @see de.cbf.util.ui.editentities.interfaces.ICompositeEditEntities#setEntitySelected(de.cbf.util.ui.editentities.interfaces.IEditableEntity)
	 */
	@Override
	public void setEntitySelected(IEditableEntity value) {
		compositeListUser.setSelectedEntity(value);
	}

}
